package com.mk.datapower.util;

/**
 * @Author: peisong.chen
 * @Date: 2019/9/16
 * @Content: 简单的常见返回数据的demo，一般是 code、message、data 形式
 */
public class ResponseUtil<T> {
    private Integer code;
    private String message;
    private T data;
    public ResponseUtil() {
    }

    public ResponseUtil(T t) {
        this.data = t;
        this.code = 10000;
        this.message = "成功";
    }

    public static ResponseUtil success (Object object) {
        return new ResponseUtil(object);
    }

    @Override
    public String toString() {
        return "ResponseUtil{" +
                "code=" + code +
                ", message='" + message + '\'' +
                ", data=" + data +
                '}';
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
